package com.k1998.mybatis.utils;

import com.alibaba.fastjson.JSON;

import java.util.HashMap;
import java.util.List;

public class HashMapUtils {
    public static <T> String toHashMap(int numbers, List<T> object) {
        HashMap<String, Object> res = new HashMap<>();
        res.put("numbers",numbers);
        res.put("data",object);
        res.put("code","success");
        String users_json = JSON.toJSONString(res);
        return users_json;
    }

    public static <T> String toHashMap(T object) {
        HashMap<String, Object> res = new HashMap<>();
        res.put("data",object);
        res.put("code","success");
        String users_json = JSON.toJSONString(res);
        return users_json;
    }


}
